﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using nplJobsBLL.Common;
using nplJobsBLL.ProcessJob;
using Elmah;

public partial class UserControls_ucJobsFooter : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            getLocation();
            getCompanies();
            getJobType();
            getSector();
        }
    }


    #region LoadControls
    public void getLocation()
    {
        try
        {
            ProcessLocation obj = new ProcessLocation();
            obj.LocationID = -1;
            obj.invoke();
            gvLocation.DataSource = obj.Location;
            gvLocation.DataBind();
        }
        catch (Exception ex)
        {
            ErrorSignal.FromCurrentContext().Raise(ex);
        }
    }

    public void getSector()
    {
        try
        {
            ProcessJobCategory obj = new ProcessJobCategory();
            obj.countryID = -1;
            obj.invoke();

            gvSector.DataSource = obj.JobCategory.Take(10).ToList();
            gvSector.DataBind();
        }
        catch (Exception ex)
        {
            ErrorSignal.FromCurrentContext().Raise(ex);
        }
    }

    public void getJobType()
    {
        try
        {
            ProcessJobType obj = new ProcessJobType();
            obj.countryID = -1;
            obj.invoke();
            if (obj.JobType != null && obj.JobType.Count > 0)
            {
                obj.JobType.RemoveAt(0);
                gvJobType.DataSource = obj.JobType;
                gvJobType.DataBind();
            }
        }
        catch (Exception ex)
        {
            ErrorSignal.FromCurrentContext().Raise(ex);
        }
    }

    public void getCompanies()
    {
        try
        {
            //ProcessSelectEmployeer obj = new ProcessSelectEmployeer();
            //obj.employeerID = Guid.Empty;


            //obj.invoke();

            //gvCompany.DataSource = obj.Employeer;
            //gvCompany.DataBind();
        }
        catch (Exception ex)
        {
            ErrorSignal.FromCurrentContext().Raise(ex);
        }
    }

    #endregion
}